package com.weng.cloud.service8881.mock;

import com.cloud.api.mock.MockArgDto;
import com.cloud.api.mock.MockResDto;
import com.google.common.collect.Lists;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @Author: weng
 * @Date: 2022/6/12
 * @Description: com.weng.cloud.service8881.mock
 */
@RestController
@RequestMapping("/mock")
public class MockOpen {

    @Resource
    MockRpc mockRpc;

    @GetMapping("/open")
    public List<MockResDto> open() {
        return mockRpc.rpc(args());
    }

    private List<MockArgDto> args() {
        return Lists.newArrayList(
                MockArgDto.builder().content("测试内容1").date(new Date()).build(),
                MockArgDto.builder().content("测试内容2").date(new Date()).build()
        );
    }
}
